<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>grid布局</title>
    <style>
        .container {
    display: grid;
    /* grid-template-columns: 1fr 1fr 1fr;   等分*/
    /* grid-template-columns: 1fr 2fr 1fr; */
    /* grid-template-rows: 50px 50px; */

    /* grid-template-columns: repeat(3, 100px); */
    /* 第一个参数指定了你想要的列数或行数，第二个参数指定了它们的宽度 */
    /* grid-template-rows: repeat(2, 50px); */

    /* 网格通常会在右侧留下空白区域 */
    grid-gap: 5px;
    /* grid-template-columns: repeat(auto-fit, 100px); */
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    grid-template-rows: repeat(2, 100px);

}
.container div {
    border:1px solid black;
}
    </style>
</head>
<body>
    <div class="container">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
      </div>
</body>
</html>